package com.zj.roseoj.judge.codesandbox;

import com.zj.roseoj.judge.codesandbox.impl.ExampleCodeSandbox;
import com.zj.roseoj.judge.codesandbox.impl.RemoteCodeSandbox;
import com.zj.roseoj.judge.codesandbox.impl.ThirdPartyCodeSandbox;

/**
 * 代码沙箱-静态工厂
 */
public class CodeSandBoxFactory {

    /**
     * 根据指定代码沙箱类型创建代码沙箱
     *
     * @param sandBoxType 代码沙箱类型
     * @return
     */
    public static CodeSandbox newInstance(String sandBoxType) {
        switch (sandBoxType) {
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "thirdParty":
                return new ThirdPartyCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    }
}
